<template>
	<view class="container">
		<image :src="`${baseImg}/static/adminShop/ryzLogo.png`" mode=""></image>
		<!-- <view class="topImg">
			<image :src="`${baseImg}/static/mall/mallBg.png`" mode=""></image>
		</view>
		<view class="navList">
			<view class="item" @click="toDesgin">
				<view class="img">
					<image :src="`${baseImg}/static/mall/shejishi.png`" mode=""></image>
				</view>
				设计师后台
			</view>
			<view class="item" @click="toShop">
				<view class="img">
					<image :src="`${baseImg}/static/mall/shangjia.png`" mode=""></image>
				</view>
				商家后台
			</view>
			<view class="item" @click="toConstr">
				<view class="img">
					<image :src="`${baseImg}/static/mall/shigongdui.png`" mode=""></image>
				</view>
				施工队后台
			</view>
			<view class="item" @click="toOneN">
				<view class="img">
					<image :src="`${baseImg}/static/mall/oneN.png`" mode=""></image>
				</view>
				1+N小区
			</view>
			<view class="item" @click="toYuanG">
				<view class="img">
					<image :src="`${baseImg}/static/mall/yuangong.png`" mode=""></image>
				</view>
				员工管理
			</view>
			<view class="item" @click="toBank">
				<view class="img">
					<image :src="`${baseImg}/static/mall/yinghangka.png`" mode=""></image>
				</view>
				银行卡管理
			</view>
			<button class="item"  @click="getUserInfo">
				<view class="img">
					<image :src="`${baseImg}/static/mall/ck.png`" mode=""></image>
				</view>
				分销中心
			</button>
			<view class="item" @click="toOutLogin">
				<view class="img">
					<image :src="`${baseImg}/static/mall/outLogin.png`" mode=""></image>
				</view>
				退出登录
			</view>
		</view> -->
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseImg:this.$static
			};
		},
		onShow() {
			let router = this.$store.state.index.page.ability
			console.log(router,'、、、、、')
			if(router.findIndex(item=>item.route == 'shopIndex')!=-1){
				uni.redirectTo({
					url:'/pagesFour/home/home'
				})
			}else if(router.findIndex(item=>item.route == 'designerIndex')!=-1){
				uni.redirectTo({
					url:'/pageTwo/home/home'
				})
			}else if(router.findIndex(item=>item.route == 'builderIndex')!=-1){
				uni.redirectTo({
					url:'/pagesOne/constr/home/home'
				})
			}else if(router.findIndex(item=>item.route == 'promoterIndex')!=-1){
				uni.redirectTo({
					url:'/pagesOne/distri/index/index'
				})
			}else{
				uni.navigateTo({
					url:'/pages/enter/index/index'
				})
			}
		},
		onHide() {
			// uni.showTabBar()
		},
		methods:{
			// 设计师后台
			toDesgin(){
				uni.navigateTo({
					url:'../../../pageTwo/home/home'
				})
			},
			// 商家后台
			toShop(){
				uni.navigateTo({
					url:'../../../pagesFour/home/home'
				})
			},
			// 施工队后台
			toConstr(){
				uni.navigateTo({
					url:'../../../pagesOne/constr/home/home'
				})
			},
			// 1+n
			toOneN(){
				uni.navigateTo({
					url:'../../../pagesThree/onePlusN/estateIndex'
				})
			},
			// 员工管理
			toYuanG(){
				uni.navigateTo({
					url:'../../../pagesOne/constr/staffManage/staffList'
				})
			},
			// 银行卡管理
			toBank(){
				uni.navigateTo({
					url:'../../../pagesOne/distri/bindBankCard/choiceBank'
				})
			},
			// 分销中心
			getUserInfo(){
				let token = this.$store.state.index.token
				if(token){
					if(uni.getUserProfile){
						uni.getUserProfile({
							desc:'Wexin',     // 这个参数是必须的
							success:res=>{
								console.log(res)
								if(res.errMsg == 'getUserProfile:ok'){
									uni.setStorageSync('userInfo',res.userInfo)
									uni.navigateTo({
										url:'../../../pagesOne/distri/index/index'
									})
								}
							},
							fail:err=>{
								console.log(err)
							}
						})
					}
					
				}
			},
			// 退出登录
			toOutLogin(){
				uni.showModal({
				    title: '提示',
				    content: '确定退出登录?',
				    success:  (res)=> {
						if (res.confirm) {
							let token = ''
							let isBindMobile = ''
							let userMobile = ''
							let userId = ''
							let role = ''
							let sid = ''
							this.$store.commit('index/SET_token', token)
							this.$store.commit('index/SET_role', role)
							this.$store.commit('index/SET_sid', sid)
							this.$store.commit('index/SET_tokenTime', Date.now())
							this.$store.commit('index/SET_isBindMobile', isBindMobile)
							this.$store.commit('index/SET_userMobile', userMobile)
							this.$store.commit('index/SET_userId', userId)
						   uni.clearStorage();
						   uni.reLaunch({
							url: '/pages/mall/index/index'
						   });
						} else{}
				    }
				});
			}
		}
	}
</script>

<style lang="less">
	page{height: 100%;}
	.container{
		width: 100%;
		height: 100%;
		position: relative;
		background: linear-gradient(180deg, #ccc 0%, #fff 100%);
		image{
			position: absolute;
			top: 0;
			left: 0;
			bottom: 0;
			right: 0;
			margin: auto;
			width: 100%;
			height: 600rpx;
		}
		// .topImg{
		// 	position: absolute;
		// 	top: 0;
		// 	left: 0;
		// 	width: 100%;
		// 	height: 600rpx;
		// 	image{
		// 		width: 100%;
		// 		height: 600rpx;
		// 	}
		// }
		// .navList{
		// 	width: 100%;
		// 	border-radius: 60rpx 60rpx 0 0;
		// 	position: absolute;
		// 	padding: 60rpx 40rpx 0 40rpx;
		// 	left: 0;
		// 	z-index: 2;
		// 	display: flex;
		// 	flex-wrap: wrap;
		// 	background-color: #fff;
		// 	top: 472rpx;
		// 	button{
		// 		padding: 0;
		// 		margin: 0 95rpx 60rpx !important;
		// 		background-color: transparent;
		// 	}
		// 	.item{
		// 		margin: 0 95rpx 60rpx;
		// 		.img{
		// 			display: flex;
		// 			justify-content: center;
		// 			width: 136rpx;
		// 			height: 136rpx;
		// 			flex-direction: column;
		// 			align-items: center;
		// 			border-radius: 50%;
		// 			background-color: rgba(195,171,124,0.1);
		// 			// padding: 24rpx;
		// 			margin-bottom: 28rpx;
		// 			image{
		// 				width: 68rpx;
		// 				height: 68rpx;
		// 			}
		// 		}
		// 		display: flex;
		// 		flex-direction: column;
		// 		align-items: center;
		// 		font: 400 28rpx/48rpx PingFang SC;
		// 		color: #333;
		// 	}
		// }
	}
</style>
